<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>店铺报表</title>
    <link rel="stylesheet" href="../css/common.css">
    <link rel="stylesheet" href="../css/page.css">
    <script src="../js/jquery-3.2.1.min.js"></script>
    <!--<script src="../js/media.js"></script>-->
    
    <script src="../js/laydate/laydate.js"></script>
    <script src="../js/common.js"></script>
    <style>
        .bd-0 {
            display: none;
        }

        .active {
            display: block;
        }
        .searchStart,.searchEnd{
        	margin-top: 0.1rem;
        	height: .44rem;
		    background: #fff;
		    overflow: hidden;
		    border-bottom: 1px solid #f2f2f2;
        }
        .searchLeft{
        	float: left;
		    width: 30%;
		    padding-left: .2rem;
		    line-height: .44rem;
        }
        .searchRight{ 
        	width:60%;
        	float: left;
           	height: .44rem;
		    line-height: .44rem;
		    text-align: right;
		    border: none;
		    outline: none;
	    }
	    .searchBtn{
	    	
	    	height: .44rem;
		    line-height: .44rem;
		    width: 40%;
		    text-align: center;
		    margin:0 auto;
		    margin-top: 0.1rem;
		    background:#37993e;
		    border-radius: 0.04rem;
		    color:#fff;
	    }
    </style>
</head>

<body>
    <!--头部-->
    <!-- <div class="public-header flex">
        <span class="public-header-left-back"></span>
        <span class="public-header-center">店铺报表</span>
        <span class="public-header-right">新建</span>
    </div> -->

    <!--正文-->
    <div class="Shop-report bc-gray">
        <div class="hd flex">
            <a href="javascript:;" class="active">资金报表</a>
            <a href="javascript:;">经营报表</a>
        </div>
        <div class="searchTime">
        	<div class="searchStart">
        		<p class="searchLeft">开始时间</p>
        		<input class="searchRight" id="startTime" placeholder="请选择开始时间">
        	</div>
        	<div class="searchEnd">
        		<p class="searchLeft">结束时间</p>
        		<input class="searchRight"id="endTime" placeholder="请选择结束时间">
        	</div>
        	<div class="searchBtn">
        		查询
        	</div>
        </div>
        <div class="bd">
            <div class="bd-1 bd-0 active">
                <ul class="ul-1">
                    <li class="title flex">
                        <span>成拍报表</span>
                       <!-- <em onclick="jacascript:window.location.href='../page/Shop-report-more.html'">更多</em>-->
                    </li>
                    <li class="flex">
                        <span>成拍数量：<font></font></span>
                        <span>笔数：<font></font></span>
                    </li>
                </ul>
                <ul class="ul-2">
                    <li class="title flex">
                        <span>销售报表</span>
                       <!-- <em onclick="jacascript:window.location.href='../page/Shop-report-more.1.html'">更多</em>-->
                    </li>
                    <li class="flex">
                        <span>已付款：<font></font></span>
                        <span>笔数：<font></font></span>
                    </li>
                    <li class="flex">
                        <span>已退款：<font></font></span>
                        <span>笔数：<font></font></span>
                    </li>
                </ul>
                <ul class="ul-3">
                    <li class="title flex">
                        <span>收款报表</span>
                       <!-- <em onclick="jacascript:window.location.href='../page/Shop-report-more.2.html'">更多</em>-->
                    </li>
                    <li class="flex">
                        <span>已收款：<font></font></span>
                        <span>笔数：<font></font></span>
                    </li>
                </ul>
                <ul class="ul-4">
                    <li class="title flex">
                        <span>待收款报表</span>
                       <!-- <em onclick="jacascript:window.location.href='../page/Shop-report-more.3.html'">更多</em>-->
                    </li>
                    <li class="flex">
                        <span>未发货：<font></font></span>
                        <span>笔数：<font></font></span>
                    </li>
                    <li class="flex">
                        <span>待确认：<font></font></span>
                        <span>笔数：<font></font></span>
                    </li>
                    <li class="flex">
                        <span>退款中: <font></font></span>
                        <span>笔数：<font></font></span>
                    </li>
                    <!--<li class="flex">-->
                        <!--<span>今日退货中：<font>1</font></span>-->
                        <!--<span>笔数：<font>1</font></span>-->
                    <!--</li>-->
                </ul>
            </div>
            <div class="bd-2 bd-0">
                <ul class="ul-1">
                    <li class="title flex">
                        <span>访客报表</span>
                      <!--  <em onclick="jacascript:window.location.href='../page/Shop-report-more.4.html'">更多</em>-->
                    </li>
                    <li class="flex">
                        <span>浏览人数：<font >1</font></span>
                        <span>访问次数：<font>1</font></span>
                    </li>
                </ul>
                <ul class="ul-2">
                    <li class="title flex">
                        <span>粉丝报表</span>
                      <!--  <em onclick="jacascript:window.location.href='../page/Shop-report-more.5.html'">更多</em>-->
                    </li>
                    <li class="flex">
                        <span>累积粉丝：<font>1</font></span>
                        <span>增长粉丝：<font>1</font></span>
                    </li>
                </ul>
                <ul class="ul-3">
                    <li class="title flex">
                        <span>产品报表</span>
                       <!-- <em onclick="jacascript:window.location.href='../page/Shop-report-more.1.html'">更多</em>-->
                    </li>
                    <li class="flex">
                        <span>发布件数：<font>1</font></span>
                        <span></span>
                    </li>
                </ul>
              <ul class="ul-4">
                    <li class="title flex">
                        <span>客户报表</span>
                        <!--<em>更多</em>-->
                    </li>
                    <li class="flex">
                        <span>付款人数：<font>1</font></span>
                        <span>新客占比：<font>1</font></span>
                    </li>
                </ul>
            </div>
        </div>
    </div>
    <script>
		var ios_stroeId = getQueryString("storeid");//获取页面ios的传值
	    function getQueryString(key) {
		    var reg = new RegExp('(^|&)' + key + '=([^&]*)(&|$)');
		    var result = window.location.search.substr(1).match(reg);
		    return result ? decodeURIComponent(result[2]) : null;
		}
	    var base_url = 'http://www.yunnantese.com/';
	    (function (doc, win) {
		    var docEl = doc.documentElement,
		        resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
		        recalc = function () {
		            var clientWidth = docEl.clientWidth;
		            if (!clientWidth) return;
		            docEl.style.fontSize = 100 * (clientWidth / 375) + 'px';
		        };
		
		    if (!doc.addEventListener) return;
		    win.addEventListener(resizeEvt, recalc, false);
		    doc.addEventListener('DOMContentLoaded', recalc, false);
		})(document, window);
    	var dataMessage={
    		storeid:ios_stroeId,
    		start_time:'',
    		end_time:''
    	}
        $('.hd a').click(function () {
            var index = $(this).index();
            $(this).addClass('active').siblings().removeClass('active');
            $('.bd-0').eq(index).addClass('active').siblings().removeClass('active');
        })
        function loadAjax(){
        	$.ajax({
                url: base_url + 'ZITAOHUI/report/funds',
                data: dataMessage,
                success: function (data) {
                    console.log(data);
                    let datas = data.extend.data;
                    let tpd = datas.tpd;//已付款
                    $('.bd-1 .ul-2 li:eq(1) span:eq(0) font').html(tpd.num);
                    $('.bd-1 .ul-2 li:eq(1) span:eq(1) font').html(tpd.num);
                    let tas = datas.tas;//成拍
                    $('.bd-1 .ul-1 li:eq(1) span:eq(0) font').html(tas.num);
                    $('.bd-1 .ul-1 li:eq(1) span:eq(1) font').html(tas.num);
                    let refunds = datas.refunds;//已退款
                    $('.bd-1 .ul-2 li:eq(2) span:eq(0) font').html(refunds.num);
                    $('.bd-1 .ul-2 li:eq(2) span:eq(1) font').html(refunds.num);
                    let receipt = datas.receipt;//已收款
                    $('.bd-1 .ul-3 li:eq(1) span:eq(0) font').html(receipt.num);
                    $('.bd-1 .ul-3 li:eq(1) span:eq(1) font').html(receipt.num);
                    let notShip = datas.notShip;//未发货
                    $('.bd-1 .ul-4 li:eq(1) span:eq(0) font').html(notShip.num);
                    $('.bd-1 .ul-4 li:eq(1) span:eq(1) font').html(notShip.num);
                    let notReceipt = datas.notReceipt;//待确认
                    $('.bd-1 .ul-4 li:eq(2) span:eq(0) font').html(notReceipt.num);
                    $('.bd-1 .ul-4 li:eq(2) span:eq(1) font').html(notReceipt.num);
//                  let returnGoods = datas.returnGoods;//退货中
//                  $('.bd-1 .ul-4 li:eq(3) span:eq(0) font').html(returnGoods.num);
//                  $('.bd-1 .ul-4 li:eq(3) span:eq(1) font').html(returnGoods.num);
                    let returnMoney = datas.returnMoney;//退款中
                    $('.bd-1 .ul-4 li:eq(3) span:eq(0) font').html(returnMoney.num);
                    $('.bd-1 .ul-4 li:eq(3) span:eq(1) font').html(returnMoney.num);
                }
            })

            $.ajax({
                url: base_url + 'ZITAOHUI/report/manage',
                data: dataMessage,
                success: function (data) {
                    console.log(data)
                    let datas = data.extend.data;
                    $('.bd-2 .ul-1 li:eq(1) span:eq(0) font').html(datas.views_dis.num);	//访问人数
                    $('.bd-2 .ul-1 li:eq(1) span:eq(1) font').html(datas.views.num);	//访问次数
                    $('.bd-2 .ul-2 li:eq(1) span:eq(0) font').html(datas.fans.num);	//累计粉丝数
                    if(datas.increase ==null ||datas.increase ==''){
                    	$('.bd-2 .ul-2 li:eq(1) span:eq(1) font').html('0');	//今日增长粉丝
                    }else{
                    	$('.bd-2 .ul-2 li:eq(1) span:eq(1) font').html(datas.increase.num);	//今日增长粉丝
                    }
                    
                    $('.bd-2 .ul-3 li:eq(1) span:eq(0) font').html(datas.publish.num);	//发布件数
                    $('.bd-2 .ul-4 li:eq(1) span:eq(0) font').html(datas.userNum.user_total);	//今日付款人数
                    $('.bd-2 .ul-4 li:eq(1) span:eq(1) font').html(datas.user_num_dis);	//新科比
                },
                error:function(data){
                    console.log(data);
                }
            })
        }
        $('.searchBtn').click(function(){
        	dataMessage.start_time =$('#startTime').val()
        	dataMessage.end_time =$('#endTime').val();
        	loadAjax()
        });
    	laydate.render({
            elem: '#startTime'
            ,type:'datetime'
        });
        laydate.render({
            elem: '#endTime'
            ,type:'datetime'
        });
		loadAjax();
    </script>
</body>
</html>